package com.epoint.flinkdemo.source;

import org.apache.flink.api.common.serialization.SimpleStringSchema;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer010;

import java.util.Properties;

/**
 * @author liufl
 * @version [版本号, 21-3-30]
 */
public class TestKafka
{
    public static void main(String[] args) throws Exception{
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        Properties properties = new Properties();
        properties.setProperty("bootstrap.servers", "192.168.151.85:9092");
        
        DataStreamSource<String> kafkaStream = env.addSource(new FlinkKafkaConsumer010<String>("testsource", new SimpleStringSchema(), properties));

        kafkaStream.print();

        env.execute();
    }
}
